﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace ListProcesses
{
    class Program
    {
        static void Main(string[] args)
        {
            
            Process [] procList = Process.GetProcesses();
            try
            {
                foreach (Process pr in procList)
                {
                    Console.WriteLine(pr.ProcessName + " " + pr.MainWindowHandle);
                   
                    Console.WriteLine(pr.Handle);
                }
                Console.ReadKey();
            }
            catch (Exception eX)
            {
                Console.WriteLine(eX.Message); 
            }
        }
    }
}
